package model.preprocessor;


/**
 * Status of a preprocessor execution.
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public enum PreProcessorResultStatus {
	TIMEOUT_REACHED ("Problem : timeout has been reached", "timeout_reached"), OK ("OK : preprocessing completed", "OK"), PROBLEM (
			"Error : a probleme occured during the preprocessing", "problem"),
	UNSATISFIABLE ("The CNF is unsatisfiable !", "unsatisfiable"), SATISFIABLE ("The CNF is satisfiable !", "satisfiable"), STOP (
			"The execution has been stop", "stop");


	private String	xmlValue;
	// private boolean hasAesult
	private String	description;

	private PreProcessorResultStatus(String description, String xmlValue) {
		this.description = description;
		this.xmlValue = xmlValue;
	}

	/**
	 * Return a description of the status.
	 * 
	 * @return a description of the status.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Return the xmlValue, value that is supposed to written in the xml exportation.
	 * 
	 * @return the xmlValue
	 */
	public String getXmlValue() {
		return xmlValue;
	}

	/**
	 * Return the {@link PreProcessorResultStatus} associate to a value find in a XML exportation.
	 * 
	 * @param value
	 *            xml value
	 * @return the associate {@link PreProcessorResultStatus}
	 */
	public static PreProcessorResultStatus getValueFromXML(String value) {
		for (PreProcessorResultStatus stat : values())
			if (stat.getXmlValue().equals(value))
				return stat;
		return null;
	}
}
